from Employees import Employee
list_employees = [
    Employee(1001, 9002, "师父", 60000),
    Employee(1002, 9001, "孙悟空", 50000),
    Employee(1003, 9002, "猪八戒", 20000),
    Employee(1004, 9001, "沙僧", 30000),
    Employee(1005, 9001, "小白龙", 15000),
]

# def con1(a):
#     return a.did == 9002
# def con2(a):
#     return len(a.name) == 2

def find_all(condition):
    for item in list_employees:
        if condition(item):
            yield item

# for item in find_all(con1):
#     print(item)
# print("-----------------------")
# for item in find_all(con2):
#     print(item)
for item in find_all(lambda a:a.did == 9002):
    print(item)
print("-----------------------")
for item in find_all(lambda a:len(a.name) == 2):
    print(item)